package predict.app.music_service;

import android.app.Service;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;

/**
 * Created by CL on 2017/9/22.
 */

public class music extends Service {
    private MediaPlayer player;

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    public void onStart(Intent intent, int starId) {
        super.onStart(intent, starId);
        player = MediaPlayer.create(this, R.raw.gequ);
        if (!player.isPlaying()) {
            player.start();
        } else {
            player.reset();
        }
    }

    public void onDestroy() {
        super.onDestroy();
        player.stop();
    }
}



















